<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<helink>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><{$tt}></title>
<link href="<{$smarty.const.BASEPATH}>/css/base.css" rel="stylesheet"/>
<link href="<{$smarty.const.BASEPATH}>/css/admin_style.css" rel="stylesheet"/>
<link href="<{$smarty.const.BASEPATH}>/css/css.css" type="text/css" rel="stylesheet" />
<link href="<{$smarty.const.BASEPATH}>/css/validform.css" type="text/css" rel="stylesheet" />

<script type="text/javascript" src="<{$smarty.const.WEBDIR}>js/jquery.min.js"></script>
<script type="text/javascript" src="<{$smarty.const.WEBDIR}>js/validform/js/Validform.min.js"></script>
<script type="text/javascript" src="<{$smarty.const.WEBDIR}>xheditor/xheditor-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
	$.extend(xheditor.settings,{skin:'nostyle',shortcuts:{'ctrl+enter':submitForm}});//修改默认设置
		$('#content').xheditor({forcePtag:false,urlType:'rel',upLinkUrl:"<{spUrl c=upload a=file immediate=1}>",upLinkExt:"zip,rar,txt,word,xls,pdt",upImgUrl:"<{spUrl c=upload a=file immediate=1}>",upImgExt:"jpg,jpeg,gif,png,bmp",upFlashUrl:"<{spUrl c=upload a=file immediate=1}>",upFlashExt:"swf",upMediaUrl:"<{spUrl c=upload a=file immediate=1}>",upMediaExt:"wmv,avi,wma,mp3,mid",onUpload:insertUpload});
    $('#upimg').xheditor({skin:'upfile',tools:'Img',urlType:'root',upImgUrl:"!{editorRoot}xheditor_plugins/multiupload/multiupload.html?uploadurl=<{spUrl c=upload a=file immediate=1}>|",onUpload:insertUpload});
}
function insertUplolink(arrMsg)
{
	var i,msg;
	for(i=0;i<arrMsg.length;i++)
	{
		msg=arrMsg[i];
		$("#uplolinkList").append('<option value="'+msg.newFilename+'">'+msg.newFilename+'</option>');
	    //$("#imglist").append('<img src="\/uplolink\/'+msg.newFilename+'" width=100>');
        //document.getElementById('allimg').value=document.getElementById('allimg').value+''+msg.newFilename;
        if($("#allimg").val()==""){
        $("#allimg").val($("#allimg").val()+msg.newFilename);
        }else{
        $("#allimg").val($("#allimg").val()+'|'+msg.newFilename);
        }
    }
}

function submitForm(){$('#frmDemo').submit();}
</script>

<link href="<{$smarty.const.BASEPATH}>/css/css.css" type="text/css" rel="stylesheet" />
<link href="<{$smarty.const.BASEPATH}>/css/validform.css" type="text/css" rel="stylesheet" />

</helink>

<body>

<script type="text/javascript">
$(function(){ // 当页面加载完毕的时候
$(".registerform:last").Validform({
		tiptype:2,
		ajaxPost:true,
		callback:function(data){
			//返回数据data是json格式，{"info":"demo info","status":"y"}
			//info: 输出提示信息;
			//status: 返回提交数据的状态,是否提交成功。如可以用"y"表示提交成功，"n"表示提交失败，在ajax_post.php文件返回数据里自定字符，主要用在callback函数里根据该值执行相应的回调操作;
			//你也可以在ajax_post.php文件返回更多信息在这里获取，进行相应操作；
			
			//这里执行回调操作;
			if(data.status=="y"){
				setTimeout(function(){
					$.Hidemsg(); //公用方法关闭信息提示框;
                    location.href="<{spUrl c=link a=index type=$type}>";
				},2000);
                
			}
		} 
	});
});
</script>
   <form class="registerform" action="<{spUrl c=link a=save}>"> 
   <table class="tab_list tab_bottom">
   <caption><a href="#">◆<{$addtitle}></a></caption>
   <tr>
   <td width="50">*分类：</td>
   <td width="320"><select name="type" id="type">
<{html_options options=$typearr selected=$type}>
</select></td><td><div class="Validform_checktip">分类必须选择!</div></td></tr>
        <tr>
            <td width="50">*标题：</td>
            <td width="320"><input type="text" value="<{$link.link_title}>" id="title" name="title" class="inputxt"  datatype="*" nullmsg="请输入标题！"  /></td>
            <td><div class="Validform_checktip">标题不能为空!</div></td>
        </tr>        
        <tr>
            <td>*描述：</td>
            <td colspan="2"><textarea name="content" id="content" rows="12" cols="80" style="width: 700px;"><{$link.link_content}></textarea></td>
        </tr>

        <tr>
            <td>*URL:</td>
            <td><input type="text" value="<{$link.link_url}>" id="link_url" name="link_url" class="inputxt" datatype="*" nullmsg="请输入网址！"  /></td>
            <td><div class="Validform_checktip">跳转到</div></td>
        </tr>
        <tr>
            <td>*排序:</td>
            <td><input type="text" value="<{$link.sort}>" id="sort" name="sort" class="inputxt"/></td>
            <td><div class="Validform_checktip">排序，小在前</div></td>
        </tr>
        <tr>
            <td>*主图：</td>
            <td><input type="hidden" name='allimg' id='allimg' value="<{$img}>"/>
            <select id="uplolinkList" name="uplolinkList" style="width:310px;" onChange="document.viewimg.src='\/uplolink\/'+options[selectedIndex].value">
            
            <option value="" selected="selected">选择并上传图片</option>
            <{foreach $allimg as $img2}>
            <option value="<{$img2}>" <{if $img2 eq $link.link_image}>selected="selected"<{/if}>><{$img2}></option>
            <{/foreach}> 
            
            
            </select></td>
            <td><textarea name="upimg" id="upimg" style="width: 25px;height:0px;"></textarea><div class="Validform_checktip" style="float: left;"></div></td>
        </tr>
        <tr>
        <td></td>
        <td colspan="2" id="imglist"><img src="uplolink/<{$link.link_image}>" onerror="this.src='<{$smarty.const.WEBDIR}>404/no.gif'" id="viewimg" name="viewimg" height="100" alt="选择你要显示的图片"/></td>
        </tr>
    </table>
<br /><br />
<div id="submit_float">
                <input type="hidden" name='action' id='action' value="<{$action}>"/>
                <input type="hidden" name='link_id' id='link_id' value="<{$link.link_id}>"/>
                <input class="newjh" type="submit" value="提 交" /> <input type="reset" value="重 置" />
</div>
</form>
</body>
</html>